import 'package:flutter/material.dart';

/// 可以封装一些跳转的动画 用于navigator的封装跳转使用
/// */
class LeftToRightPageRoute extends PageRouteBuilder {
  final Widget newPage;

  LeftToRightPageRoute({required this.newPage})
      : super(
            pageBuilder: (BuildContext context, Animation<double> animation,
                    Animation<double> secondaryAnimation) =>
                newPage,
            transitionsBuilder: (BuildContext context,
                    Animation<double> animation,
                    Animation<double> secondaryAnimation,
                    Widget child) =>
                SlideTransition(
                  position:
                      Tween(begin: const Offset(-1, 0), end: const Offset(0, 0))
                          .animate(animation),
                  child: child,
                ));
}
